package arsw.twitter.model;

import java.io.Serializable;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class LinkedListStack<A> implements Stack<A>, Iterable<A>, Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private List<A> list = new LinkedList<A>(); 
	
	@Override
	public boolean empty() {
		return list.isEmpty();
	}

	@Override
	public A peek() {
		return list.get(0);
	}

	@Override
	public A pop() {
		return list.remove(0);
	}

	@Override
	public A push(A item) {
		list.add(0,item);
		return item;
	}

	@Override
	public Iterator<A> iterator() {
		return list.iterator();
	}

}
